package cn.ncupyh.comptest;
//递归求和
public class OrderSum {
    public static void main(String[] args) {
        //1+2+3+4+5+6+7+8+9+10
        int s = orderSum(3);
        System.out.println(s);
    }

    private static int orderSum(int num) {
        if(num == 1){
            return 1;
        }
        int sum = num + orderSum(num-1);
        return sum;
    }
}
